package com.kotlin.dongdong.demo.ui.login

import com.kotlin.dongdong.framework.http.RetrofitManage
import com.kotlin.dongdong.framework.http.resultentity.BackResult
import com.kotlin.dongdong.framework.http.resultentity.BookEntity
import com.kotlin.dongdong.framework.http.resultentity.loginEntity
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers

/**
 * Created by dongdongzheng on 2018/2/12.
 */
class LoginModel : LoginContract.Model {
    override fun getBook(): Observable<BookEntity> {
        //TODO("not implemented") //To change body of created functions use File | Settings |
        // File Templates.
        return RetrofitManage.get()!!.userService!!.getBook().subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
    }

    override fun login(phone: String, pwd: String): Observable<BackResult<loginEntity>> {
        // TODO("not implemented") //To change body of created functions use File | Settings |
        // File Templates.
        return RetrofitManage.get().userService!!.login(phone, pwd).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
    }
}

